/**
 * 
 */
package cardbs.domain;

import java.util.Calendar;
import java.util.Set;
import java.util.HashSet;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.CascadeType;

/** 
 * <!-- begin-UML-doc -->
 * <!-- end-UML-doc -->
 * @author marianna
 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
 */
@Entity
@Table(name="Service")
public class Service {
	/** 
	 * <!-- begin-UML-doc -->
	 * <!-- end-UML-doc -->
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	@ManyToOne(fetch=FetchType.LAZY )
	@JoinColumn(name="trafficNo")
	private Vehicle vehicle;

	/** 
	 * @return the vehicle
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	public Vehicle getVehicle() {
		// begin-user-code
		return vehicle;
		// end-user-code
	}

	/** 
	 * @param vehicle the vehicle to set
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	public void setVehicle(Vehicle vehicle) {
		// begin-user-code
		this.vehicle = vehicle;
		// end-user-code
	}

	/** 
	 * <!-- begin-UML-doc -->
	 * <!-- end-UML-doc -->
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	@Id
	@Column(name="serviceCode")
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Integer serviceCode;

	/** 
	 * @return the serviceCode
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	public Integer getServiceCode() {
		// begin-user-code
		return serviceCode;
		// end-user-code
	}

	/** 
	 * @param serviceCode the serviceCode to set
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	public void setServiceCode(Integer serviceCode) {
		// begin-user-code
		this.serviceCode = serviceCode;
		// end-user-code
	}

	/** 
	 * <!-- begin-UML-doc -->
	 * <!-- end-UML-doc -->
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	@Column(name="startDate")
	private Calendar startDate;

	/** 
	 * @return the startDate
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	public Calendar getStartDate() {
		// begin-user-code
		return startDate;
		// end-user-code
	}

	/** 
	 * @param startDate the startDate to set
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	public void setStartDate(Calendar startDate) {
		// begin-user-code
		this.startDate = startDate;
		// end-user-code
	}

	/** 
	 * <!-- begin-UML-doc -->
	 * <!-- end-UML-doc -->
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	@Enumerated(EnumType.STRING)
	private Status status;

	/** 
	 * @return the status
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	public Status getStatus() {
		// begin-user-code
		return status;
		// end-user-code
	}

	

	/** 
	 * <!-- begin-UML-doc -->
	 * <!-- end-UML-doc -->
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	@Column(name="endDate")
	private Calendar endDate;

	/** 
	 * @return the endDate
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	public Calendar getEndDate() {
		// begin-user-code
		return endDate;
		// end-user-code
	}

	/** 
	 * @param endDate the endDate to set
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	public void setEndDate(Calendar endDate) {
		// begin-user-code
		this.endDate = endDate;
		// end-user-code
	}

	/** 
	 * <!-- begin-UML-doc -->
	 * <!-- end-UML-doc -->
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	@ManyToMany
	@JoinTable(name="WorksDoneInService",joinColumns = {@JoinColumn(name="serviceCode")},inverseJoinColumns = {@JoinColumn(name="workCode")})
	private Set<Work> works = new HashSet<Work>();

	/** 
	 * @return the work
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	public Set<Work> getWorks() {
		// begin-user-code
		return new HashSet<Work>(works);
		// end-user-code
	}

	public void setAWork(Work work){
		if(work!=null){
			works.add(work);
		}
	}
	public void removeAWork(Work work){
		if(work!=null){
			works.remove(work);
		}
	}
	/** 
	 * @param work the work to set
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	public void setWork(Set<Work> work) {
		// begin-user-code
		this.works = work;
		// end-user-code
	}

	/** 
	 * <!-- begin-UML-doc -->
	 * <!-- end-UML-doc -->
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	@ManyToOne
	@JoinColumn(name="headmasterCode")
	private Employee headmaster;

	/** 
	 * @return the headmaster
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	public Employee getHeadmaster() {
		// begin-user-code
		return headmaster;
		// end-user-code
	}

	/** 
	 * @param headmaster the headmaster to set
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	public void setHeadmaster(Employee headmaster) {
		// begin-user-code
		this.headmaster = headmaster;
		// end-user-code
	}

	/** 
	 * <!-- begin-UML-doc -->
	 * <!-- end-UML-doc -->
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */

	/** 
	 * <!-- begin-UML-doc -->
	 * <!-- end-UML-doc -->
	 * @param status
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	public void setStatus(cardbs.domain.Status status) {
		// begin-user-code
		// TODO Auto-generated method stub
			this.status=status;
		// end-user-code
	}

	/** 
	 * <!-- begin-UML-doc -->
	 * <!-- end-UML-doc -->
	 * @param work
	 * @return
	 * @generated "UML to Java (com.ibm.xtools.transform.uml2.java5.internal.UML2JavaTransform)"
	 */
	public HashSet getWork(Work work) {
		// begin-user-code
		// TODO Auto-generated method stub
		return null;
		// end-user-code
	}
	public Service() {
		// begin-user-code
		// TODO Auto-generated constructor stub
		// end-user-code
	}
}